<template>
  <div class="blur">
    <q-tab-panels
      class="bg-transparent"
      v-model="actionTab"
      animated
      style="height: calc(100vh - 100px)"
    >
      <plan-table name="planTable" />
      <single-device-plan name="single" />
      <action-processing name="processing" />
      <action-waiting name="waiting" />
    </q-tab-panels>
    <q-tabs
      v-model="actionTab"
      class="text-grey"
      inline-label
      align="center"
      active-color="primary"
      indicator-color="primary"
      narrow-indicator
    >
      <q-tab name="planTable" icon="list_alt" label="预设方案" />
      <q-tab name="single" icon="color_lens" label="当前单机方案" />
      <q-tab name="processing" icon="color_lens" label="当前多机方案" />
      <q-tab name="waiting" icon="ballot" label="待执行" />
    </q-tabs>
  </div>
</template>

<script>
import { useFunctionsStore } from "stores/functions";
import PlanTable from "components/actionPlan/panels/PlanTable.vue";
import ActionProcessing from "components/actionPlan/panels/ActionProcessing.vue";
import ActionWaiting from "components/actionPlan/panels/ActionWaiting.vue";
import { provide, ref } from "vue";
import SingleDevicePlan from "components/actionPlan/panels/SingleDevicePlan.vue";

const typeOptions = [
  { label: "取货", value: "load", type: "transport-catch" },
  { label: "放货", value: "unload", type: "transport-catch" },
  { label: "机械臂移动", value: "posture", type: "transport-catch" },
  { label: "进流线", value: "attach", type: "transport-catch" },
  { label: "退流线", value: "detach", type: "transport-catch" },
  { label: "料盘取放", value: "operate", type: "transport-catch" },
  { label: "取货", value: "load", type: "transport-as-rs" },
  { label: "放货", value: "unload", type: "transport-as-rs" },
  { label: "顶升控制", value: "lift", type: "transport-lift" },
  { label: "顶升存料", value: "lift-in", type: "transport-lift" },
  { label: "顶升取料", value: "lift-out", type: "transport-lift" },
  { label: "进工位", value: "lift-in", type: "amr" },
  { label: "退工位", value: "lift-exit", type: "amr" },
  { label: "普通移动", value: "move-basic", type: "amr" },
  { label: "带方向移动", value: "move-directional", type: "amr" },
  { label: "直线行驶", value: "move-straight", type: "amr" },
  { label: "等待反馈", value: "await", type: "amr" },
  { label: "静止指定时间", value: "still", type: "amr" },
  { label: "寻找最近点位", value: "find-type", type: "amr" },
];

const groupOptions = [
  { label: "配送机器人", value: "transport-cargo" },
  { label: "运输机器人（顶升）", value: "transport-lift" },
  { label: "运输机器人（抓取）", value: "transport-catch" },
  { label: "运输机器人（立体库）", value: "transport-as-rs" },
  { label: "基础运动", value: "amr" },
];

export default {
  name: "ActionPlan",
  components: { SingleDevicePlan, ActionWaiting, ActionProcessing, PlanTable },
  setup() {
    provide("typeOptions", typeOptions);
    provide("groupOptions", groupOptions);
    provide("amrTypes", [
      {
        label: "所有机器人",
        value: null,
      },
      {
        label: "运输机器人（顶升）",
        value: "transport-lift",
      },
      {
        label: "运输机器人（抓取）",
        value: "transport-catch",
      },
      {
        label: "运输机器人（立体库）",
        value: "transport-as-rs",
      },
    ]);
    provide("poseTypes", [
      {
        label: "库位点（抓取）",
        value: "storage-catch",
      },
      {
        label: "工位点（顶升）",
        value: "station-lift",
      },
      {
        label: "工位点（抓取）",
        value: "station-catch",
      },
      {
        label: "工位点（立体库）",
        value: "station-port",
      },
      {
        label: "无类型",
        value: null,
      },
      {
        label: "反光柱",
        value: "reflector",
      },
      {
        label: "停车位",
        value: "parking-spot",
      },
      {
        label: "待命点",
        value: "standby",
      },
      {
        label: "避让点",
        value: "avoid",
      },
      {
        label: "充电桩点位",
        value: "charger",
      },
      {
        label: "传送点（同层）",
        value: "teleport",
      },
      {
        label: "传送点（电梯）",
        value: "teleport-elevator",
      },
      {
        label: "闸门控制点",
        value: "gate",
      },
      {
        label: "避障控制点",
        value: "narrow",
      },
      {
        label: "速度控制点",
        value: "speed",
      },
    ]);
    provide("navigationTypes", [
      {
        label: "激光SLAM导航",
        value: "slam",
      },
      {
        label: "磁条导航",
        value: "magv",
      },
    ]);

    return {
      functions: useFunctionsStore(),
      actionTab: ref("planTable"),
    };
  },
};
</script>
